package agent.strategy;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * User: Darren
 * Date: 18/05/13
 * Time: 11:33 AM
 */
public class StrategyExecutor {
    private ExecutorService executor = Executors.newCachedThreadPool();

    public void executeStrategy(Runnable strategy) {
        Future<?> futureStrategy = executor.submit(strategy);
        // block waiting for the strategy to complete
        while (!futureStrategy.isDone()) {}
    }
}
